package main;

import java.util.ArrayList;

public class SimpleNumbersGen{
	
	private int size;
	
	public SimpleNumbersGen(int size){
		this.size = size;
	}
	
	
	public ArrayList<Integer> getSimpleNumbers(){
		
		ArrayList<Integer> list = new ArrayList<>();
		
		for(int i = 2; i<size ; ++i){
			list.add(i);
		}
		
		int curPos = -1;
		while(curPos++ < list.size() - 1){
			int curNum = list.get(curPos);
			
			if(curNum == 0 || curNum == 1) continue;
			
			for(int i = curPos + 1; i < list.size(); ++i){
				if(list.get(i) % curNum == 0){
					list.remove(i);
					i--;
				}
			}
		}
		
		return list;
		
	}
	

}
